'use strict';
const {
  Base64
} = require("base64")
const db = uniCloud.database()
exports.main = async (event, context) => {
  //event为客户端上传的参数
  console.log('event : ', event)
  let base = new Base64()
  event.newArticle.openid = JSON.parse(base.decode(event.newArticle.openid))
  const res = await db.collection('article').add(event.newArticle)
  //返回数据给客户端
  return res
};
